package com.igame.Service.impl;

import com.igame.Service.CategoriesService;
import com.igame.common.Result;
import com.igame.mapper.CategoriesMapper;
import com.igame.vo.CategoriesVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoriesImpl implements CategoriesService {
    @Autowired
    CategoriesMapper categoriesMapper;


    @Override
    public Result<List<CategoriesVo>> selectCategories() {
        Result<List<CategoriesVo>> result =Result.success();
        result.setData(categoriesMapper.findAll());
        result.setState(true);

        return result;
    }

    @Override
    public Result<String> getNameById(Integer id) {
        return Result.success(categoriesMapper.selectById(id));
    }
}
